EnemyBulletMove =class("EnemyBulletMove");


function EnemyBulletMove:ctor(firePoint,speed,sice)
    self.gameObject=newObject(ThunderManager.prefabs[sice]);
    
    self.transform = self.gameObject.transform;

    self.transform.position=firePoint.position;
    self.transform.rotation=firePoint.rotation;

    self.rigid = self.gameObject:GetComponent('Rigidbody2D');
    self.rigid.velocity = -firePoint.up*speed;
    
    local luaTrigger = self.gameObject:AddComponent(typeof(LuaRigidTrigger));
    luaTrigger:AddHandler(self.OnTriggerEnter2D,self);
    
end

function EnemyBulletMove:OnTriggerEnter2D(collider)
    if(collider.tag=="Player")then
    destroy(self.gameObject);
    PlayerMove.Hurt();
    
    end
    
end
